home *** CD-ROM | disk | FTP | other *** search
/ C & C++ Multimedia Cyber Classroom / C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso / src / fig16_26.jar / Ch16 / Fig16_26 / Fig16_26.cpp
C/C++ Source or Header  |  1997-11-10  |  506b  |  21 lines

  1. // Fig. 16.26: fig16_26.cpp
  2. // Using strtoul
  3. #include <iostream.h>
  4. #include <stdlib.h>
  5.  
  6. int main()
  7. {
  8.    unsigned long x;
  9.    char *string = "1234567abc", *remainderPtr;
  10.  
  11.    x = strtoul( string, &remainderPtr, 0 );
  12.    cout << "The original string is \"" << string
  13.         << "\"\nThe converted value is " << x
  14.         << "\nThe remainder of the original string is \""
  15.         << remainderPtr
  16.         << "\"\nThe converted value minus 567 is " 
  17.         << x - 567 << endl;
  18.    return 0;
  19. }
  20.  
  21.